--
-- Description: script to create the Logs table.
-- This table will store the range dates for the event pull and their processing
-- times.
-- Date created: 24 Apr 2008
--

set ANSI_NULLS on
set QUOTED_IDENTIFIER on
go

if not exists 
(
    select * 
    from dbo.sysobjects
    where id = object_id(N'[dbo].[Logs]')
    and objectproperty(id, N'IsUserTable') = 1
)
begin
    create table [dbo].[Logs]
    (
        [LogID] int identity(1,1) not null
		, [FileID] int not null
        , [RangeStartDate] smalldatetime not null
        , [RangeEndDate] smalldatetime not null
        , [ProcessingStartDate] smalldatetime null
        , [ProcessingEndDate] smalldatetime null
        constraint [PK_Logs] primary key clustered
        (
			[LogID] asc
        ) on [primary]
    ) on [primary]

    print ''
    print '*************************************************************************************'  
    print 'Created table [dbo].[Logs]'
    print '*************************************************************************************'  
    print ''
end
else
begin
    print ''
    print '*************************************************************************************'  
    print 'Table [dbo].[Logs] already exists.'
    print '*************************************************************************************'  
    print ''
end
